package com.example.metrolpolitano;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.Toast;

public class Transporte extends Activity implements OnClickListener{
	/**
	 * @see android.app.Activity#onCreate(Bundle)
	 */
		TextView metro, tren;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.transporte);
		
		metro = (TextView) findViewById(R.id.metro);
		metro.setOnClickListener(this);
		tren = (TextView) findViewById(R.id.tren);
		tren.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		
		if (v.getId() == findViewById(R.id.metro).getId()){
			
			Toast.makeText(Transporte.this, "Sección Metropolitano", Toast.LENGTH_LONG).show();
			AlertDialog.Builder builder = new AlertDialog.Builder(this);
			builder.setMessage("¿A dónde quiere ir?").setPositiveButton("De Sur a Norte", dialogClickListener)
			    .setNegativeButton("De Norte A Sur", dialogClickListener).show();
			
		}
		if (v.getId() == tren.findViewById(R.id.tren).getId()){
			
			Toast.makeText(Transporte.this, "Estamos en Construcción", Toast.LENGTH_LONG).show();
			
		}
	}
	
	// Dialogo
	DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
	    @Override
	    public void onClick(DialogInterface dialog, int which) {
	        switch (which){
	        case DialogInterface.BUTTON_POSITIVE:
	            //Yes button clicked
	        	Toast.makeText(Transporte.this, "Ponemos unas variables", Toast.LENGTH_LONG).show();
	            break;

	        case DialogInterface.BUTTON_NEGATIVE:
	            //No button clicked
	        	Toast.makeText(Transporte.this, "Ponemos otras variables", Toast.LENGTH_LONG).show();
	            break;
	        }
	    }
	};

	
}
